package com.north.light.androidutils;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.north.light.androidutils.audio.ui.AudioActivity;
import com.north.light.androidutils.ble.BLEActivity;
import com.north.light.androidutils.canvas.CanvasActivity;
import com.north.light.androidutils.containrecyclerview.ContainRecyActivity;
import com.north.light.androidutils.coordinatorLayout.CoordinatorCollapsingActivity;
import com.north.light.androidutils.coordinatorLayout.CoordinatorLayoutAppbarLayoutActivity;
import com.north.light.androidutils.coordinatorLayout.CoordinatorLayoutBehaviorFirstActivity;
import com.north.light.androidutils.dagger.DaggerActivity;
import com.north.light.androidutils.draglayout.DragLayoutActivity;
import com.north.light.androidutils.drawer.DrawerActivity;
import com.north.light.androidutils.external.SavePicActivity;
import com.north.light.androidutils.glide.GlideLoadActivity;
import com.north.light.androidutils.landscope.VideoOrgActivity;
import com.north.light.androidutils.libpicsel.LibPicSelActivity;
import com.north.light.androidutils.location.LocationActivity;
import com.north.light.androidutils.network.NetStatusActivity;
import com.north.light.androidutils.novel.NovelActivity;
import com.north.light.androidutils.novel.NovelWidgetActivity;
import com.north.light.androidutils.permission.PermissionActivity;
import com.north.light.androidutils.photoview.MediaPreviewActivity;
import com.north.light.androidutils.recyclerview.custom.test.XRecyActivity;
import com.north.light.androidutils.recyclerview.scrollview.ScrollViewRecyActivity;
import com.north.light.androidutils.recyclerview.sdk.SDKXrecyclerviewActivity;
import com.north.light.androidutils.recyclerview.sdk.SDkSmartActivity;
import com.north.light.androidutils.recyclerview.sliper.SliperActivity;
import com.north.light.androidutils.shareele.ShareElementActivity;
import com.north.light.androidutils.viewpagervideo.ViewPagerVideoActivity;
import com.north.light.androidutils.viewshot.ViewShotActivity;
import com.north.light.androidutils.water.WaterActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
//        TimerUtil timerUtil = new TimerUtil();
//        timerUtil.setLooperCallback(new TimerUtil.LooperCallback() {
//            @Override
//            public void looper(String key, long interval) {
//                Log.d("looper", "looper key:" + key + "\tinterval: " + interval);
//            }
//        });
//        timerUtil.start("1",1200,false,false);
//        timerUtil.start("2",2000,true,true);
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                try {
//                    Thread.sleep(6000);
//                    timerUtil.start("1",1200,false,true);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//            }
//        }).start();

//        Observable.create(new ObservableOnSubscribe<Integer>() {
//            @Override
//            public void subscribe(@NonNull ObservableEmitter<Integer> emitter) throws Throwable {
//                emitter.onError(new Exception(System.currentTimeMillis() + ""));
//            }
//        })
//                .retryWhen(new RxBaseRetryFunction(3, 3000))
//                .subscribe(new Observer<Integer>() {
//                    @Override
//                    public void onSubscribe(@NonNull Disposable d) {
//                        LogUtil.d("onSubscribe");
//                    }
//
//                    @Override
//                    public void onNext(@NonNull Integer integer) {
//                        LogUtil.d("onNext");
//                    }
//
//                    @Override
//                    public void onError(@NonNull Throwable e) {
//                        LogUtil.d("onError");
//                    }
//
//                    @Override
//                    public void onComplete() {
//                        LogUtil.d("onComplete");
//                    }
//                });
    }


    public void initView() {
        findViewById(R.id.shareEle).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, ShareElementActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.libpicsel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, LibPicSelActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.libpicsel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, LibPicSelActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.mediapreview).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, MediaPreviewActivity.class);
                startActivity(intent);
            }
        });
//        findViewById(R.id.mediapreview).performClick();
        findViewById(R.id.sliper).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, SliperActivity.class);
                startActivity(intent);
            }
        });
//        findViewById(R.id.sliper).performClick();
        findViewById(R.id.activity_main_recy_scroll).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, ScrollViewRecyActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_contain_permission).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, PermissionActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_contain_recyclerview).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, ContainRecyActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_viewshot).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, ViewShotActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_coor).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, CoordinatorLayoutAppbarLayoutActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_draglayout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, DragLayoutActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_coor2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, CoordinatorLayoutBehaviorFirstActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_coor3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入CoordinatorLayout act
                Intent intent = new Intent(MainActivity.this, CoordinatorCollapsingActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_novel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入novel act
                Intent intent = new Intent(MainActivity.this, NovelActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_novel_widget).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入novel act
                Intent intent = new Intent(MainActivity.this, NovelWidgetActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_audio).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //进入novel act
                Intent intent = new Intent(MainActivity.this, AudioActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_recy).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, XRecyActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_recy2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, SDKXrecyclerviewActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_recy3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, SDkSmartActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_netstatus).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, NetStatusActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_drawer).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, DrawerActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_dagger).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, DaggerActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_ble).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, BLEActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_location).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, LocationActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_canvas).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, CanvasActivity.class);
                startActivity(intent);
            }
        });
//        findViewById(R.id.activity_main_canvas).performClick();
        findViewById(R.id.activity_main_water).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, WaterActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_viewpager_video).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ViewPagerVideoActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_main_glide).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, GlideLoadActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_video_rote).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, VideoOrgActivity.class);
                startActivity(intent);
            }
        });
        findViewById(R.id.activity_external_pic).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, SavePicActivity.class);
                startActivity(intent);
            }
        });


//        PyObject backend = PythonManager.getInstance().getPythonObj("backend");
//        String encryptedText = backend.callAttr("hill_cipher", "学习python").toString();
//        try {
//            PythonManager.getInstance().init(this);
//            String encryptedText = encryptedText = PythonManager.getInstance()
//                    .getPythonFunRes("hellow", "add", 1,2).toString();
//            LogUtil.d("encryptedText: " + encryptedText);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }


}
